<template>
  <div class="history">
      <div class="recently">
          <div class="head">
              <div class="title">历史记录</div>
              <van-icon name="delete-o" @click="clearCtx" />
          </div>
          <div class="container">
              <van-tag plain type="primary" color="black" v-for="item in history"  :key="item.id" @click="search(item.keyword)">{{item.keyword}}</van-tag>
          </div>
      </div>
      <div class="hot">
          <div class="head">
              <div class="title">热门搜索</div>
          </div>
          <div class="container">
              <van-tag plain type="primary"  v-for="item in hotList"  :class="{'hotActive':item.is_default}" :key="item.id"  @click="search(item.keyword)">{{item.keyword}}</van-tag>
          </div>
      </div>
  </div>
</template>

<script>
export default {
    data(){
        return{
        }
    },
    props:['hotList','history'],
    methods:{
        search(keyword){
            this.$emit('historyKeyword',keyword)
        },
        clearCtx(){
            this.$emit('clearHistory')
        }


    }

}
</script>

<style lang="less" scoped>
.history{
    margin-top: 1px;
    width: 100%;
    .recently{
        background-color:#fff;
        box-sizing: border-box;
        width: 100%;
        padding: 30px 20px;
        .head{
            
            width: 100%;
            display: flex;
            justify-content: space-between;
            .title{
                font-size: 28px;
            }
            .van-icon{
                font-size: 30px;
            }
        }
        .container{
            width: 100%;
            padding: 20px 0;
            .van-tag{
                margin-top: 20px;
                margin-right: 20px;

                font-size: 25px;
                padding: 15px;
                
            }
        }
    }
    .hot{
        margin-top: 20px;
        background-color:#fff;
        box-sizing: border-box;
        width: 100%;
        padding: 30px 20px;
        .head{
            
            width: 100%;
            display: flex;
            justify-content: space-between;
            .title{
                font-size: 28px;
            }
            .van-icon{
                font-size: 30px;
            }
        }
        .container{
            width: 100%;
            padding: 20px 0;
            .van-tag{
                margin-top: 20px;
                margin-right: 20px;

                font-size: 25px;
                padding: 15px;
                color: black;
                border: black 1px solid;
                
            }
            .hotActive{
                color: var(--imp);
                border:2px solid var(--imp);
                
                background-color: #ffffff;
            }
        }
    }
}

</style>